home *** CD-ROM | disk | FTP | other *** search
-
- [the following is an ascii version of the paper given out at the developer's
- forum this past May, 1992, and was the companion to the Totally Insane (tm)
- CD accompanying tom davis' and paul haeberli's presentation. all references
- to the Totally Insame (tm) CD itself however have been supplanted with
- references to the developer's toolbox CD structure -- ratitor ]
-
-
-
- Graphics Utility Tools and Libraries CD
-
- Paul Haeberli
- Silicon Graphics Computer Systems
-
-
-
- Abstract
-
- The Iris Graphics Library supports interactive drawing of lighted
- 3-D geometry, but sometimes the interface provided by the GL is
- not the most convenient or general. For example, filling concave
- polygons or describing lighting can be complex and unpleasant tasks.
-
- This paper describes libraries and tools that are available to
- solve many common graphics problems. These tools
- handle problems like triangulating concave regions for rapid display,
- drawing character strings using geometry, creating beveled
- and extruded shapes, automatic generation of triangle meshes,
- environment mapping 3-D geometry, dithering rgb images and drawing
- anti-aliased characters.
-
-
-
- Introduction
-
- A variety of graphics tools will be discussed. Here's a brief
- overview:
-
- Several image related library functions will be described, along
- with various conversion programs. Then special image processing
- tools for environment maps will be introduced.
-
- After image related stuff, it's on to geometry. We have a simple
- geometry format and a set of programs that can display or modify
- this geometry. The complete source code to these programs is
- included.
-
- Next it's outline fonts. There's a paint program for generating
- outline fonts and tools for transforming outline descriptions into
- filled characters using triangle meshes. A library that draws
- anti-aliased characters is provided, along with tools for reading
- Adobe Type1 fonts and generating Type 3 fonts.
-
- Then, a few miscellaneous things are discussed, like a nice
- interface for viewing geometry, general dithering code and easier
- GL lighting.
-
- In addition to this, theres a whole bunch of other insane stuff.
- You'll just have to read the rest of the paper to find out. I can't
- get everything into the stinking introduction!
-
-
- Acknowledgements
-
- The software described here was developed with the help of many
- other people.
-
- Kurt Akeley wrote the auto meshing functions & the geometry capping
- example (located in toolbox/src/exampleCode/cap).
- Ivan Bach wrote the DPSGLX demo (/toolbox/src/exampleCode/GLX/dpsglx).
- Gavin Bell and Thant Tessman wrote the original virtual sphere
- interface for viewing geometry.
- Forest Baskett kindly let us spend time on this.
- David Brown made his face available in digital form.
- Derrick Burns developed the concave polygon triangularization library
- (toolbox/src/haeberli/lib/libtri.a).
- Nancy Cam provided the a image warping application called tiepoint
- (toolbox/bin/tiepoint).
- Simon Carter at Abekas provided code for converting between digital
- video format and rgb space (toolbox/src/haeberli/abekas).
- Kathy Chaix cleverly tricked us into organizing this CDROM.
- Tom Davis contributed calc - a simple calculator
- (toolbox/src/exampleCode/calc), generic - a generic application
- template (toolbox/src/swtools/generic), geometer - a program for
- creating geometric proofs (toolbox/src/tutorials/geometer),
- 3Dmodeling - a library for creating 3-D geometry
- (toolbox/src/exampleCode/3Dmodeling), and zip - a FAST editor for
- the IRIS (toolbox/bin/zip).
- Dave Larson provided funding for publishing the CDROM.
- Sam Leffler wrote the TIFF image library (toolbox/src/haeberli/libtiff).
- David Maynard developed the audio mesh application - amesh
- (toolbox/src/demos/audio/amesh).
- Reuel Nash developed iso, an iso-surface rendering program
- (toolbox/src/exampleCode/iso).
- Dave Ratcliffe helped us get this source together.
- Seth Teller wrote the font painting program and several of the other
- font tools.
- Doug Voorhies developed mtex, a program to help make texture maps from
- scanned images (toolbox/src/haeberli/mtex).
-
- This paper refers to various source files and programs. These files
- are located on the "Totally Insane Graphics Tools and Utilties" CDROM.
-
-
- Image Stuff
-
- By an image, we mean a rectangular array of pixels. On the Iris, we
- currently use our own SGI image file format to store image data. This
- format is used for screen dumps and for printing. A program called
- "ipaste" displays an Iris image on the screen.
-
- The Iris image library is called "libimage.a" and it is installed in
- /usr/lib on all Iris workstations. You can look in the the directory
- /toolbox/src/haeberli/libimage if you want to see the implementation of
- the actual image library. Normally you will only need to call a few
- different routines in the image library to read or write an Iris image
- file, or you can make a single call to read all the pixels in an image
- into an array of longs. Take a look at the program imgtools/rectimg.c
- as an example of how to read pixel data from an image file in a easy
- way.
-
- It's easy to write simple filters that operate on Iris images. The
- source to a number of image processing programs can be found in the
- imgtools directory. Some of these tools read and write other image
- file formats, while others operate on Iris image files. A simple
- program that saturates an Iris image can be found in imgtools/saturate.c
-
- A few image tools deserve special note. The programs "fromyuv" and
- "toyuv" convert between Abekas digital video images and Iris image
- files. These tools can be used to record images from the Iris on a
- device that supports digital video data, or to make an image that can
- be displayed on the Iris. Routines that generate and read digital
- video data can be found in libgutil/abekas.c
-
- A program called "gendit" supports general dithering of Iris images. It
- takes an RGB image as input and writes out an RGB image with a smaller
- number of colors. You can specify on the command line how many levels
- of red, green and blue may be used in the output image. This program
- uses the code in libgutil/gendit.c to perform an ordered dither. This
- dithering technique can be used to display good looking continuous tone
- images in the overlay planes or the underlay planes.
-
- At times you may need to resize an Iris image. This can be done with
- the program "izoom". The source can be found in imgtools/izoom.c You
- can specify a floating point scale factor for resizing in x and y. You
- can also specify the kind of filtering to use when resizing.
-
- The program "imgtools/scope" can be used to roam around very high
- resolution images quickly, examine actual pixels values in an image and
- determine exact pixel locations.
-
- The program "movie" lets you view a series of images as a movie loop.
-
- Finally "scrsave" can be used to save an image from the screen as an
- Iris image file. Take a look at the function savewindow in
- libgutil/glstuff.c. It shows how to execute scrsave from inside a
- graphics program to save the current window as an image file.
-
-
- Tiff Library Support
-
- An important industry image file standard is the TIFF image format.
- Eventually we will be using TIFF as our standard image file format.
- You can find complete source to a library that reads and writes TIFF
- in public/tiff. There are also two Iris programs in imgtools called
- "totiff" and "fromtiff" that can convert Iris images into tiff images
- and back.
-
-
- Environment Map Tools
-
- Environment or Reflection mapping is a technique that uses texture
- mapping to simulate the smooth shading of reflective surfaces. It
- can be used to create very nice shading of more diffuse surfaces as
- well. The program objtools/spin can be used to draw an object with
- environment mapping. A variety of tools for creating and manipulating
- environment maps are provided in the envtools directory.
-
- The primary format of an environment map is a single Iris image file
- that has a 3 by 2 array of square images from 6 faces of a cube.
- Environment maps can be created in several ways. One way is to take a
- 180 degree fisheye picture of a scene, scan in this image and then
- project this onto the cubical format. The program "envtools/fromfish"
- does exactly this. The result of this is an image like those in the
- "envmaps" directory.
-
- These environment map images can be processed using the many of the
- Iris image tools. But when it comes to doing area processes, special
- tools are needed. The program "envreduce" zooms a cubical environment
- map down by a factor of two, while the program "envexpand" zooms a
- cubical environment map up by a factor of two. These two programs can
- be used in sequence to blur cubical environment maps.
-
- In the IRIX 4.0 release, the VGX and Indigo machines have support for
- using the normal of surfaces to provide texture map coordinates for
- reflection mapping. The format used for environment mapping is not a
- cubical format but a spherical format. The program "envtools/sphereenv"
- can be used to convert an environment map in cubical format into a
- spherical format. When doing this you MUST use the "-s" option so a
- reflective sphere is rendered. Other environment map creation tools
- are also available in the "envtools" directory.
-
- A collection of processed spherical environment maps can be found in
- the directory called "128env". These can be used on machines that
- support texture mapping to render very nice looking surfaces. We are
- actively collecting interesting reflection maps. If you would like to
- contribute some, please let me know.
-
-
- Texture Map collection
-
- A small collection of 128x128 texture maps can be found in the
- directory called "128tex". We are actively collecting interesting
- texture map images that are 128x128 or 256x256. If you make some
- really neat textures, we would really like to include them in our
- collection!
-
-
- A Simple Geometry Format
-
- Over the past years we've had a lot of discussion about file formats
- for geometry. It's a difficult and complex topic. At one end of the
- scale you could use an interpreted language and at the other end of
- the scale you could just use a data structure for storing geometry.
- Languages have the advantage that they are very flexible and may be
- extended easily. A simple geometry data structure has the advantage
- that you can easily define operations on objects.
-
- I have a simple format that I've been using for polygonal objects.
- The library source that suports this format is in libgutil/sgiobj.c
- and libgutil/sgiobjgl.c. Each sgo object is either a list or
- quadrilaterals, a list of triangles, or a list of triangle meshes.
- Each vertex in one of these objects has a 3D position, a normal and
- 3 values that are either a RGB color or a texture map coordinate.
-
- A collection of sgo objects is provided in the "objects" directory.
- Various tools for operating on these objects can be found in the
- "objtools" directory. The program "spin" reads in one of these
- objects and lets the user control the scale and orientation of the
- object using a virtual sphere user interface. Another tool "totri"
- transforms objects that are lists of quads into triangle list objects.
- The program "tomesh" converts a list of triangles into a triangle
- mesh object. These tools use various functions from libgutil that
- support a simplified interface to describing shading, automatic
- triangle mesh generation and efficient drawing of geometry.
-
- The program "subdiv" subdivides a list of triangles object to insure
- that no triangle in an object are larger than some specified size,
- while "explode" translates all vertices in the direction of their
- normal. The program "sterrend" in the objtools directory shows how to
- display geometry using Red-Green Stereo, while "warpgeom" applies a
- deformation to a geometric object.
-
-
- Font Tools
-
- I've developed a binary file format for storing fonts. These fonts
- can either be polygonal outlines (font.of), spline outlines (font.sp),
- or triangle meshes (font.mf). The basic support for this file format
- is in libgutil/objfnt.c, while libgutil/charfill.c has code that
- creates and draws anti-aliased bitmaps of a outline font.
-
- A collection of outline fonts is provided in the "fonts" directory .
- But new ones can easily be created using the programs in the
- "fonttools" directory.
-
- A program called "paintfont" allows you to paint each character to
- define an outline font. Each painting is autotraced to create
- polygonal outlines. The code that converts an image into outlines is
- in libgutil/stream.c. Once polygonal outlines are created, the
- program "adjustfont" can be used to adjust the character spacing and
- character widths in the outline font.
-
- You can see what anti-aliased renderings of the characters look like
- by running "charfill". Adobe Type1 fonts can be converted into
- polygonal or spline format by using "fromtype1". If you want to draw
- characters using triangle meshes, the program "meshfont" converts a
- font.of file into a font.mf file automatically.
-
- The program "bevelstring" can be used to create 3D geometry from a
- string of text. This program uses the library code in libgutil/path.c
- to provide support for describing and filling concave regions.
-
- If you want to make PostScript fonts that can be used with DPS or a
- laser printer, the program "makepsfont" can be used to generate a
- Type3 font and an AFM file.
-
-
- Audio Analysis Example
-
- Amesh (toolbox/src/demos/audio/amesh) is a program that makes audio
- visible by plotting a real-time history of sequential power spectra
- computed from an audio input stream. FFT-fu, Audio-fu; Paul-Bob sez:
- "Check it out".
-
-
- Making "Paintings" from Images
-
- The "impression" directory has tools for creating painted
- representations of scanned images interactively. To give this a try,
- type "make demo" in the "impression" directory. The other tools in
- this directory can be used to manipulate paintings described by a
- list of brush strokes.
-
- The "autopaint" directory has tools for automatically creating
- paintings. To try this out, type "make demo" in the "autopaint"
- directory.
-
-
- A Little Paint Program for the Iris
-
- The "imp" directory has the source for a fun little paint program
- for the IRIS. It does all its drawing into memory and then copies
- the result onto the screen. You can zoom the canvas image up to do
- detailed work. To try this out, cd to "imp" and type "make demo".
- This program uses the "libcan" library to blend brush strokes onto
- the canvas.
-
-
- Enhance Images Interactively
-
- The "enhance" directory has the source for an image enhancement
- program that let's you enhance a source image by choosing an image
- processing operation, and then picking an image from a range of
- processed images. To give this program a try, type "make demo" in
- the "enhance" directory.
-
-
- LEEP Projection for VR Display
-
- The program in "leep" implements the LEEP projection in software.
- This maps a 140 degree viewing angle into a circle, as required by
- the optics provided by LEEP. To try this out, cd to "leep" and type
- "make demo".
-
-
- Use Compression to Display Movies
-
- Take a look in the "movie" directory . There is a program called
- "mkmov" for compressing a series of images and another one called
- "expmov" to display a compressed movie. To see it go, you guessed it,
- just type "make demo".
-
- Prepare Texture Map Images
-
- Look in the "mtex" directory. This contains an image processing
- application that massages scanned images for use as texture maps. It
- performs common operations such as color or contrast correction,
- cropping, and sharpening, plus unusual functions needed for texture
- maps. These include making edges match so the image can be used as a
- tile, "homogenizing" a texture to eliminate splotchiness and
- gradations, and synthesizing an alpha channel from the color
- information.
-
-
- Miscellaneous Goo
-
- The programs above rely on a collection of library routines that are
- in lib, libcan and libgutil. These libraries support the virtual
- sphere user interface, automatic triangularization of complex concave
- areas, automatic triangle mesh generation, drawing of anti-aliased
- characters, conversion from RGB to CMYK space, and more. There is also
- a vector and matrix library, functions to help make it easier to use GL
- lighting and routines to generate PostScript images and drawings.
-
-
- An Apology
-
- In keeping with the informal nature of this conference, we began
- preparing this document at 2:30 for a 5:00 deadline, so there are
- still a few things we didn't have time to describe. This gives YOU
- the opportunity to explore the following directories on your own:
- Check out Tom Davis's stuff in toolbox/src/exampleCode/calc,
- toolbox/src/swtools/generic, toolbox/src/tutorials/geometer,
- toolbox/src/exampleCode/3Dmodeling and toolbox/bin/zip. Then look at
- toolbox/src/exampleCode/cap, compexp,
- toolbox/src/exampleCode/GLX/dpsglx, toolbox/src/printers/dpsprint,
- toolbox/src/exampleCode/iso, styline, toolbox/bin/tiepoint, tools,
- and tools/tritest.
-
-
- If you are interested you may want to compile the libraries and tools
- and take a look at the README files provided. Good luck, and have fun!
-
-